package com.rrx.mapper;

import com.rrx.model.Address;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface AddressMapper {
    /*添加*/
    @Insert(" INSERT  INTO  address(province,city,area,location,userid,time) VALUES (#{province},#{city},#{area},#{location},#{userid},#{time})")
    public Integer addone(@Param("province") String province, @Param("city") String city, @Param("area") String area, @Param("location") String location, @Param("userid") String userid, @Param("time") Long time);

    /*查询*/
    @Select("select * from address where userid=#{userid}")
    public ArrayList<Address> getAll(@Param("userid") Integer userid);

    /*删除*/
    @Delete(" DELETE FROM address WHERE id=#{id}")
    public Integer delOne(@Param("id") Integer id);

    /*修改*/
    @Update( "UPDATE address SET  province=#{province},city=#{city},area=#{area},location=#{location}WHERE  userid=#{userid}")
     public Integer modityone(@Param("province") String province, @Param("city") String city, @Param("area") String area, @Param("location") String location, @Param("userid") String userid);
}
